//
//  send_enc_pb_message.cpp
// ~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2013-2014 Razvan Coca (razvan dot coca at  gmail dot com)
// This is mostly generated code. Generator is distributed under GPL. Edit it to suit your needs.
// 



#include "send_enc_pb_message.hpp"
#include <boost/bind.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <boost/asio.hpp>

#include "patterns/command.hpp"
#include "patterns/handlers.hpp"

#include "logging/logging.hpp"

namespace pcmd=patterns::command;
namespace phdl=patterns::handlers;
namespace ba=boost::asio;
namespace bs=boost::system;
namespace bt=boost::posix_time;

#include "components/defs/util_types.hpp"
#include "components/defs/client_processor.hpp"
#include "components/network/send_enc_pb_message.hpp"
namespace components{
namespace network{


bool send_enc_pb_message::cancel()
{

            try{
                bool retcode=true;
                LOG(WARNING)<<name_<<"::"<<__FUNCTION__;
                msocket_.cancel();
                return retcode;
            }
            catch(std::exception &e){
               LOG(WARNING)<<name_<<"::"<<__FUNCTION__<<":"<<e.what();
               return false;
            }
            
        
}

boost::shared_ptr<send_enc_pb_message> send_enc_pb_message::create(ba::io_service& ios,ba::ip::udp::socket& msocket,udp_endpoint_t& local_if,udp_endpoint_t& mgroup)
{

    return boost::shared_ptr<send_enc_pb_message>(new send_enc_pb_message(ios,msocket,local_if,mgroup));
}

send_enc_pb_message::send_enc_pb_message(ba::io_service& ios,ba::ip::udp::socket& msocket,udp_endpoint_t& local_if,udp_endpoint_t& mgroup)
    :ios_(ios), msocket_(msocket), local_if_(local_if), mgroup_(mgroup)
{

            name_=std::string(__FUNCTION__);
            DLOG(INFO)<<name_<<"()";
            
        
}

send_enc_pb_message::~send_enc_pb_message()
{
    DLOG(INFO)<<name_<<"::"<<__FUNCTION__<<std::endl;
}
}//end namespace network
}//end namespace components

